﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using System.Text.RegularExpressions;

namespace BaiduIntern.Model
{
    [DataContract]
    public class InternJob
    {
        public string Title { get; set; }   
        [XmlAttribute]
        public string JobLink { get; set; }
        public int? ApplyNum { get; set; }
        public int? PlanNum { get; set; }   
        [XmlAttribute]
        public string Type { get; set; }   
        [XmlAttribute]
        public string Location { get; set; }   
        public string Duty { get; set; }
        public string Requirement { get; set; }   

        private string jobId;

        public string JobId
        {
            get
            {
                if (String.IsNullOrEmpty(JobLink))
                    return null;
                else
                {
                    var reg = new Regex(@"/(\d*)");
                    var match = reg.Match(JobLink);
                    return match.Groups[1].Value;
                }

            }
            set
            {
                jobId = value;
            }
        }
    }
}
